<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="page"  uri="/tags/fenye.tld" %>
<c:set var="webpath" value="${pageContext.request.contextPath}"></c:set>
<script src="${webpath}/js/jquery/jquery-1.3.js" type="text/javascript"></script>
<link rel="stylesheet" href="${webpath}/comstyle/table.css"/>
<script type="text/javascript">

/*
$(function(){
    $('#password').bind('keydown', function(event){
        if (event.keyCode == 13) {
            login();
        }
    });
});
*/
var webContext = "${webpath}";
function login() {
	$.ajax({
				type : "post",
				cache : false,
				url : webContext + "/user/loginUserAction.action",
				data:{
					username:$("#username").val(),
					password:$("#password").val()
				}, 
				dataType : "json",//html 
				beforeSend: function(XMLHttpRequest){
	   			},
				success: function(data, textStatus){
					if(data.success) {
						window.location.href = webContext + "/user/clientQueryIndex.jsp"
					} else {
						alert("用户名或密码错误。");
					}
				},
				error : function(XMLHttpRequest, textStatus, errorThrown){
					//如果发生异常则打印出异常提示信息
				}
			});
}
</script>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'clientAdd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="${pageContext.request.contextPath}/comstyle/My97DatePicker/WdatePicker.js"></script>
  </head>
  
  <body>
  <br><br><br><br><br><br><br><br><br><br><br>
  <form onsubmit="javascript:return false;">
    <table align="center" cellspacing="1" summary="The technical specifications of the Apple  PowerMac G5 series">
       <tr ><th colspan="2">用户登陆</td></tr>
	   <tr><td>用户名</td>	<td><input type="text" id="username"/></td></tr>
	   <tr><td>密码</td>	<td><input type="password" size="21"id="password" /></td></tr>
	   <tr><td colspan="2"><input type="submit" id="submit" onclick="login()" value="登陆"/><input type="reset" value="重置"/></td></tr>
    </table>
</form>
  </body>
</html>
